package com.example.myskyjava.controller;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class ExlRead {
    String PATH = "E:/myGitee/mySky/sky/mySky-java";

    public void exlTestRead() throws IOException {

//        创建一个流
        FileInputStream inputStream = new FileInputStream(PATH+"/测试exl写入.xlsx我去尼玛07S.xlsx");
//    创建一个工作薄
//        Workbook workbook = new HSSFWorkbook(inputStream); //这个是解析 xls
        Workbook workbook = new XSSFWorkbook(inputStream); //这个是解析 xlsx

//    创建一个工作表 “我是一个工作狂”是名字
        Sheet sheet = workbook.getSheetAt(0);

        Row row = sheet.getRow(0);
        Cell cell = row.getCell(0);
        System.out.println(cell.getStringCellValue());






    }
}
